#include "settingsdialog.h"
#include "ui_settings.h"
#include <QSettings>
#include <QFileDialog>

SettingsDialog::SettingsDialog() :
        QDialog(0), ui(new Ui::SettingsDialog)
{
    ui->setupUi(this);

    connect(ui->browsePathButton, SIGNAL(clicked()), SLOT(browse()));

    QSettings settings;
    ui->pathEdit->setText(settings.value("collection/path").toString());
}

void SettingsDialog::browse()
{
    QSettings settings;
    QString directory = QFileDialog::getExistingDirectory(this,
                                tr("Find Collection"), QDir::currentPath());
    if (!directory.isEmpty()) {
        settings.setValue("collection/path", directory);
        ui->pathEdit->setText(directory);
    }
}
